import axios from "axios";

// 创建axios实例
const _axios = axios.create({});
// 添加响应拦截器
_axios.interceptors.response.use(
  function (response) {
    // 获取数据成功做些什么
    // 返回响应对象中的data即可
    return response.data;
  },
  function (error) {
    // 响应失败
    return Promise.reject(error);
  }
);

const Food_douguo='https://apis.netstart.cn/douguo'
// 推荐
export const Food_tuijian=(data={})=>{
  return _axios.get(`${Food_douguo}/home/recommended/0/20`, { params: data });
}
// 最新
// recommended/20/10
export const Food_zuixin=(data={})=>{
  return _axios.get(`${Food_douguo}/home/recommended/20/10`, { params: data });
}
// 分类
export const Food_classfiy=(data={})=>{
  return _axios.get(`${Food_douguo}/recipe/flatcatalogs`, { params: data });
}
// 热门搜索（search页面）
export const Food_hot=(data={})=>{
  return _axios.get(`${Food_douguo}/recipe/search/hot`, { params: data });
}
// 菜谱搜索keyword
export const Food_search=(keyword,data={})=>{
  return _axios.get(`${Food_douguo}/recipe/search?keyword=${keyword}`, { params: data });
}
// 搜索建议
export const Food_suggest=(kw,data={})=>{
  return _axios.get(`${Food_douguo}/recipe/search/suggests?kw=${kw}`, { params: data });
}
// 菜谱详情
export const Food_recipeid=(id,data={})=>{
  return _axios.get(`${Food_douguo}/recipe/detail/${id}`, { params: data });
}
// 营养分析
export const Food_nutrient=(id,data={})=>{
  return _axios.get(`${Food_douguo}/recipe/nutrient/${id}`, { params: data });
}


// https://apis.netstart.cn/music/lyric?id=2136745697
// export const personalized_gechi=(id,data={})=>{
//   return _axios.get(`${MUSIC_HOST_URL}/lyric?id=${id}`, { params: data });
// }